<template>
	<view>
		<my-animation :share="share" :height="height" @display="display">
			<template v-slot:spOne>
				<view class="title">
					<view class="title-left">
						<image :src="goBackImg" @click="display"></image>
					</view>
					<view class="title-center">
						<text>{{qzTitle}}{{title}}</text>
					</view>
					<view class="title-right" @click="submitText">
						<view>
							<text>完成</text>
						</view>
					</view>
				</view>
				<view class="con">
					<view class="con-left">
						<text>{{title}} : </text>
					</view>
					<input class="con-center" v-model="inputValue" placeholder="请输入" @input="inputMonitor" />
					<view class="con-right" v-if="inputValue != ''">
						<image class="con-img" :src="clearImg" @click="clearInputValue"></image>
					</view>
				</view>
			</template>
		</my-animation>
	</view>
</template>

<script>
	import myAnimation from '@/components/common/my-animation/my-animation.vue'

	export default {
		components: {
			myAnimation
		},
		props: {
			share: {
				type: Boolean,
				default: false
			},
			height: {
				type: String,
				default: '600'
			},
			title: {
				type: String,
				default: ''
			},
			qzTitle: {
				type: String,
				default: '修改'
			},
			isDetermine: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				goBackImg: require('@/static/img/common/goBack.svg'),
				clearImg: require('@/static/img/common/clear.svg'),
				inputValue: ''
			}
			velu
		},
		methods: {
			//输入框监听
			inputMonitor() {
				//console.log(this.inputValue)
			},
			//清空输入框数据
			clearInputValue() {
				this.inputValue = ''
			},
			//提交输入文字
			submitText() {
				if (this.isDetermine && this.inputValue.length == 0) {
					return uni.$showMsg('请输入！');
				}

				this.$emit('submitText', this.inputValue)
			},
			//关闭弹框
			display() {
				this.$emit('display')
			}
		}
	}
</script>

<style scoped lang="scss">
	.title {
		display: flex;
		height: 100rpx;

		.title-left {
			width: 20%;
			text-align: left;

			image {
				margin-left: 20rpx;
				margin-top: 40rpx;
				width: 40rpx;
				height: 40rpx;
			}
		}

		.title-center {
			width: 60%;
			line-height: 100rpx;
			text-align: center;

			text {
				font-size: 36rpx;
				font-weight: 500;
				color: rgba(56, 56, 56, 1);
			}
		}

		.title-right {
			width: 20%;
			text-align: right;

			view {
				width: 120rpx;
				height: 60rpx;
				margin-top: 20rpx;
				text-align: center;
				line-height: 60rpx;
				border-radius: 30rpx;
				background-color: rgba(7, 193, 96, 1);

				text {
					font-size: 32rpx;
					font-weight: 400;
					color: #fff;
				}
			}



		}
	}

	.con {
		display: flex;
		width: 100%;
		// height: 100rpx;

		.con-left {
			width: 25%;
			line-height: 100rpx;
			text-align: center;
			color: rgba(166, 166, 166, 1);
			font-size: 26rpx;
		}

		.con-center {
			width: 60%;
			font-size: 30rpx;
			height: 50rpx;
			margin-top: 25rpx;
			border-bottom: 1rpx solid rgba(166, 166, 166, 1);
		}

		.con-right {
			width: 15%;
			text-align: center;

			image {
				margin-top: 30rpx;
				width: 40rpx;
				height: 40rpx;
			}
		}
	}
</style>